package com.zzy.controller;

import com.zzy.entity.User;
import com.zzy.mapper.UserMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/user/register")
public class UserRegister extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UserMapper userMapper = new UserMapper("t_user", User.class);
        User user = new User(2,"zzy","333","man","3132820261@1.com","1517399","hunan",0,1);
        userMapper.insert(user);
        // TODO: 2022/4/13 获取用户信息 插入数据库

        String email = req.getParameter("email");
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        String gender = req.getParameter("gender");
        String telephone = req.getParameter("telephone");
        String introduce = req.getParameter("introduce");

        //注册成功
        req.getRequestDispatcher("/client/registersuccess.jsp").forward(req,resp);

    }
}
